[#67] Fix reader dashboard missing pagination#69
Conversation
Fixes #67 - Add .range() pagination with PAGE_SIZE=50 and Supabase count:"exact" for accurate total count without fetching all rows - Add prev/next page controls when more than one page exists - Total $PLOT display scoped to current page to avoid inaccurate sums Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
LGTM. Pagination logic is clean — .range() with count: "exact" is the correct Supabase pattern, query key includes page for proper cache isolation, and button disabled states are correct.
One minor edge case to consider for a follow-up: if the user switches wallets while on page > 0, page state doesn't reset to 0. This could briefly show an empty page (e.g. "Page 4 of 1") until the user clicks Prev. A useEffect that resets page to 0 when address changes would fix this. Not blocking since it's an uncommon interaction and the original bug (no pagination at all) is properly fixed.
Approved.
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: REQUEST CHANGES
Summary
The pagination change addresses the unbounded query and CI is green, but it leaves the dashboard in an invalid page state when the connected wallet changes.
Findings
- [medium] Pagination state is never reset or clamped when
addresschanges, so switching from a wallet on page N to a wallet with fewer pages can fetch an out-of-range slice and render a false empty state. Example: wallet A on page 3 -> switch to wallet B with 12 donations -> query runs for rows 150-199,totalCountis 12, the UI shows "12 donations" and "No donations yet", and the pager disappears becausetotalPagesbecomes 1.- File:
src/app/dashboard/reader/page.tsx:36 - Suggestion: Reset
pageto0whenever the connectedaddresschanges, or clamppageafter each fetch whenpage >= totalPages.
- File:
Decision
Requesting changes because this produces incorrect reader-dashboard results for a normal wallet-switch flow.
Prevents stale page index from showing false empty state when switching to a wallet with fewer donations. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
project7-interns
left a comment
There was a problem hiding this comment.
LGTM. The useEffect page reset on address change properly addresses the wallet-switch edge case. Clean fix. Approved.
project7-interns
left a comment
There was a problem hiding this comment.
Verdict: APPROVE
Summary
The pagination fix now addresses the original unbounded donation query and also correctly resets pagination when the connected wallet changes. The updated PR matches issue #67 and the lint-and-typecheck check is passing.
Findings
- none
Decision
Approving because the reader dashboard now paginates the donation query safely, provides navigation, and avoids the false empty-state regression from wallet switching.
Summary
.range()pagination (50 per page) with Supabasecount: "exact"for accurate total count without fetching all rowsFixes #67
Test plan
npm run lintandnpm run typecheckpass🤖 Generated with Claude Code